<table border="0" cellpadding="0" cellspacing="0" width="100%" height="500">
	<tr valign="top">
		<td>
			<table border="0" cellpadding="0" cellspacing="0" width="100%" height="450">
				<tr valign="top">
					<td>
						<div id="noticia">
							<table border="0" cellpadding="0" cellspacing="0" width="100%">
								<tr>
									<td height="30"><h1><a href="noticias/<?php echo getNaturalUrl($principalNewResult['noticia_id'],$newsResult['title']); ?>"><?php echo $newsResult['title']; ?></a></h1></td>
								</tr>
								<tr>
									<td height="30">
									<?php 
										setlocale( LC_TIME, "spanish" );
										echo "Publicado el ".strftime( "%A %d %B %Y", strtotime($newsResult['insert_dt']));
										if(isset($principalNewResult['noticia_id'])) {
											$tagsString = "select t.name from tags_noticias tn, tags t where tn.tag_id=t.tag_id and tn.noticia_id=".$principalNewResult['noticia_id'];
											$tagsQuery = dbSelect($tagsString) or die("Error en ".$tagsString." ".mysql_error());
											$isFirst = true;
											while ($tagsResult = mysql_fetch_array($tagsQuery)) {
												if($isFirst) {
													echo " - Tags: ";
													$isFirst = false;
												} else {
													echo " - ";
												}
												echo "<a href='../tags/".$tagsResult['name']."'>".$tagsResult['name']."</a>";
											}
										}
					
									?>
									</td>
								</tr>
								<tr>
									<td>
										<?php echo $newsResult['body']; ?>
									</td>
								</tr>
							</table>
						</div>
						<table border="0" cellpadding="0" cellspacing="0" align="right">
							<tr>
								<td><a href="noticias/<?php echo getNaturalUrl($principalNewResult['noticia_id'],$newsResult['title']); ?>">Ver m&aacute;s...</a></td>
							</tr>
						</table>
					</td>
					<td width="300" height="250">
						<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
							<tr valign="top">
								<td>ADSENSE</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td height="70">
			<table border="1" cellpadding="0" cellspacing="0" height="100%" width="100%">
				<tr>
					<td>ADSENSE</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr><td height="20"></td></tr>
	<tr valign="top">
		<td height="70">
			<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
				<tr valign="top">
					<td>
						<table border="0" cellpadding="0" cellspacing="0">
							<tr>
								<td>Noticias relacionadas:</td>
							</tr>
							<?php
							$noticiasRelacionadasString = " SELECT tn.noticia_id, n.title, count( tn.noticia_id )".
														  " FROM tags_noticias tn, noticias n".
														  " WHERE tn.tag_id IN (".
														  " SELECT tag_id FROM tags_noticias WHERE noticia_id =".$principalNewResult['noticia_id'].")".
														  " AND tn.noticia_id !=".$principalNewResult['noticia_id'].
														  " AND tn.noticia_id=n.noticia_id".
														  " GROUP BY tn.noticia_id, n.title".
														  " ORDER BY count( tn.noticia_id ) DESC".
														  " LIMIT 0,7 ";
							$noticiasRelacionadasQuery = dbSelect($noticiasRelacionadasString) or die("Error en ".$noticiasRelacionadasString." ".mysql_error());
							$noticiasConDescrNotToShow = "";
							$isFirst = true;
							while ($noticiasRelacionadasResult = mysql_fetch_array($noticiasRelacionadasQuery)) {
								if($isFirst) {
									$isFirst = false;
									$noticiasConDescrNotToShow = $noticiasRelacionadasResult['noticia_id'];
								} else {
									$noticiasConDescrNotToShow = $noticiasConDescrNotToShow.",".$noticiasRelacionadasResult['noticia_id'];
								}
								echo "<tr><td><li style='margin-left:15px;'><a href='noticias/".getNaturalUrl($noticiasRelacionadasResult['noticia_id'],$noticiasRelacionadasResult['title'])."'>".$noticiasRelacionadasResult['title']."</a></li></td></tr>";
							}
							?>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr><td height="15"></td></tr>
	<tr>
		<td width="100%">
			<table border="0" cellpadding="2" cellspacing="0" width="100%" height="100%">
				<?php 
				$rowCount=1;
				$colCount=1;
				$noticiasConDescrString = "select noticia_id,title,body from noticias where status='A'";
				if(isset($noticiasConDescrNotToShow) && $noticiasConDescrNotToShow!='') {
					 $noticiasConDescrString = $noticiasConDescrString." and noticia_id not in (".$noticiasConDescrNotToShow.")";
				}
				$noticiasConDescrString = $noticiasConDescrString." LIMIT 0,6";
				$noticiasConDescrQuery = dbSelect($noticiasConDescrString) or die("Error en ".$noticiasConDescrString." ".mysql_error());
				while ($noticiasConDescrResult = mysql_fetch_array($noticiasConDescrQuery)) {
					if($colCount==1) {
						echo "<tr valign='top'>";
					}
					echo "<td width='50%' height='160'>";
					echo "<table border='0' cellpadding='0' cellspacing='3' width='100%' height='100%'>";
					echo "<tr><td bgcolor='#CCCCCC' height='20'><a href='noticias/".getNaturalUrl($noticiasConDescrResult['noticia_id'],$noticiasConDescrResult['title'])."'><div class='tit_rel'>".$noticiasConDescrResult['title']."</div></a></td></tr>";
					echo "<tr valign='top'><td bgcolor='#A4A4A4' height='100%'>".substr($noticiasConDescrResult['body'],0,300)."...<a href='noticias/".getNaturalUrl($noticiasConDescrResult['noticia_id'],$noticiasConDescrResult['title'])."'>Seguir leyendo...</a></td></tr>";
					echo "</table>";
					echo "</td>";
					if($colCount==2) {
						echo "</tr>";
						$colCount=1;
						$rowCount++;
					} else {
						$colCount++;
					}
				}
				if($colCount==2) {
					echo "<td></td>";
				}
				?>
			</table>
		</td>
	</tr>
	<tr><td height="15"></td></tr>
	<tr>
		<td>
			Busquedas relacionadas: 
			<?php
				/*$relatedTagsString = "";
				$relatedTagsQuery = dbSelect($relatedTagsString) or die("Error en ".$relatedTagsString." ".mysql_error());
				while ($relatedTagsResult = mysql_fetch_array($relatedTagsQuery)) {

				}*/
			?>
		</td>
	</tr>
	<tr><td height="15"></td></tr>
</table>
